package com.platform.user.controller;

import com.platform.bean.Result;
import com.platform.user.service.ItemApplyService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.Map;

@RestController
@RequestMapping("itemApply")
public class ItemApplyController {

    @Resource
    private ItemApplyService itemApplyService;

    @PostMapping("addItemApply")
    public Result<Map<String, Object>> addItemApply(@RequestBody Map<String, Object> params) throws IOException {
        return Result.ok(itemApplyService.addItemApply(params));
    }

    @PostMapping("queryUserIfApply")
    public Result<Map<String, Object>> queryUserIfApply(@RequestBody Map<String, Object> params) {
        return Result.ok(itemApplyService.queryUserIfApply(params));
    }

    @PostMapping("applicantUserQueryApplyItemByPage")
    public Result<Map<String, Object>> applicantUserQueryApplyItemByPage(@RequestBody Map<String, Object> params) {
        return Result.ok(itemApplyService.applicantUserQueryApplyItemByPage(params));
    }

    @PostMapping("withdrawApply")
    public Result<Map<String, Object>> withdrawApply(@RequestBody Map<String, Object> params) {
        itemApplyService.withdrawApply(params);
        return Result.ok("ok");
    }

    @PostMapping("updateApply")
    public Result<Map<String, Object>> updateApply(@RequestBody Map<String, Object> params) {
        itemApplyService.updateApply(params);
        return Result.ok("ok");
    }

    @PostMapping("deleteApply")
    public Result<Map<String, Object>> deleteApply(@RequestBody Map<String, Object> params) {
        itemApplyService.deleteApply(params);
        return Result.ok("ok");
    }

    @PostMapping("publisherUserQueryApplyItemList")
    public Result<Map<String, Object>> publisherUserQueryApplyItemList(@RequestBody Map<String, Object> params) {
        return Result.ok(itemApplyService.publisherUserQueryApplyItemList(params));
    }
}
